<template>
	<view class="" v-if="show">
		<image :style="{top:top+'vh',right:right+'rpx' }" class="resize-animation" src="/static/zhibo_img1.png" mode="" @click="handleClick"></image>
	</view>
</template>

<script>
	export default {
		name: 'tuiImg',
		props: {
			name: {
				type: String,
				default: ''
			},
			size: {
				type: Number,
				default: 32
			},
			color: {
				type: String,
				default: '#999'
			},
			bold: {
				type: Boolean,
				default: false
			},
			top: {
				type: String,
				default: "10"
			},
			right: {
				type: String,
				default: "30"
			},
			index: {
				type: Number,
				default: 0
			},
			show: {
				type: Boolean,
				default: false
			},
		},
		created() {
			console.log(12112)
		},
		methods: {
			handleClick() {
				let that = this
				
				that.tui.request('api.auth.room/roomList', "POST", {page:1}, false, false, true).then((res) => {
					if(res.code==1){
						if(res.data.list.length==0){
							uni.setStorageSync('iszhibo',false)
							that.tui.toast('直播已结束')
							that.$emit('finish', false);
						}else{
							uni.setStorageSync('zhiboStatus',res.data.list[0])
							that.tui.href('/pages/zhibo/zhibo?zhiboid='+res.data.list[0].id+"&inviter_code="+uni.getStorageSync('inviter_code')+"&yaoqing="+uni.getStorageSync('refCode'))
							uni.setStorageSync('iszhibo',true)
							that.$emit('finish', true);
						}
					}
				}).catch((res) => {
					
				})
				
				return
				this.$emit('click', {
					index: this.index
				});
			}
		}
	};
</script>

<style scoped>
	@charset "UTF-8";
	image{width:200rpx;height: 200rpx;position: fixed;z-index: 1111;top: 10vh;right: 30rpx;}
	.resize-animation {
	    animation: resize 3s infinite alternate ease-in-out;
	  }
	 
	  @keyframes resize {
	    0% {
	      transform: scale(0.9);
	    }
		50% {
		  transform: scale(1);
		}
	    100% {
	      transform: scale(0.9); /* 变为原始大小的两倍 */
	    }
	  }
</style>
